// Brooks and Kurtz 2012 IO

// Load original dataset
clear
use "BK2012 IO Rep Data.dta"

// REPLICATION
summarize
display c(k)
mdesc
tabmiss
codebook year
codebook conum
gen elngdpcap = exp(lngdpcap)
summarize

// Table 1
// Model 1
xtgls kaopen l1.diffusionpeer_wtavg l1.diffusionisipeer_wtavg l1.diffusiongrowth_wtavg l1.diffusioninflation_wtavg l1.diffusionnegative_wtavg l1.diffusionembi_wtavg l1.under_imf_augmented isi_objective partisan checks l1.usffr l1.lninflation l1.bankra l1.cab l1.growth l1.tradebalance lngdpcap lngdp break timetrend   y1995 if year>1982 & pop>1000000, c(psar1) p(h) force
mdesc 
codebook year if e(sample)
codebook conum if e(sample)

// Model 2
xtgls kaopen l1.diffusionisipeer_wtavg l1.diffusiongrowth_wtavg l1.diffusioninflation_wtavg l1.diffusionnegative_wtavg l1.diffusionembi_wtavg l1.under_imf_augmented isi_objective partisan checks l1.usffr l1.lninflation l1.bankra l1.cab  l1.growth l1.tradebalance lngdpcap lngdp break timetrend   y1995 if year>1982 & pop>1000000, c(psar1) p(h) force
codebook year if e(sample)
codebook conum if e(sample)

// IMPUTATION
clear
use "BK2012 IO Imp Data.dta"
summarize

mi import flong, m(imp) id(conum year) imp(kaopen-diffusionisipeer_wtavg_usffr)

mi xtset conum year

// Table 1
// Model 1
mi estimate, cmdok post: xtgls kaopen l1.diffusionpeer_wtavg l1.diffusionisipeer_wtavg l1.diffusiongrowth_wtavg l1.diffusioninflation_wtavg l1.diffusionnegative_wtavg l1.diffusionembi_wtavg l1.under_imf_augmented isi_objective partisan checks l1.usffr l1.lninflation l1.bankra l1.cab l1.growth l1.tradebalance lngdpcap lngdp break timetrend   y1995 if year>1982 & pop>1000000, c(psar1) p(h) force

// Model 2
mi estimate, cmdok post: xtgls kaopen l1.diffusionisipeer_wtavg l1.diffusiongrowth_wtavg l1.diffusioninflation_wtavg l1.diffusionnegative_wtavg l1.diffusionembi_wtavg l1.under_imf_augmented isi_objective partisan checks l1.usffr l1.lninflation l1.bankra l1.cab  l1.growth l1.tradebalance lngdpcap lngdp break timetrend   y1995 if year>1982 & pop>1000000, c(psar1) p(h) force


